13. Exercise: Implement drawBackAndUnclippedRectangle()
23 13 AAK DrawClippedRectangle
Exercise
In this exercise you will Implement the drawBackAndUnclippedRectangle() method.
To see the
drawClippedRectangle()method in action, draw the first unclipped rectangle by implementing thedrawUnclippedRectangle()method as shown below.a. Save the
canvas.b. Translate to the first row and column position.
c. Draw by calling
drawClippedRectangle().d. Then restore the
canvasto its previous state.
private fun drawBackAndUnclippedRectangle(canvas: Canvas){
canvas.drawColor(Color.GRAY)
canvas.save()
canvas.translate(columnOne,rowOne)
drawClippedRectangle(canvas)
canvas.restore()
}
- Run your app. You should see the first white rectangle with its circle, red line, and text on a gray background.